<html>
<head>


	<script type="text/javascript">
		var aJaxURL	= "server-side/report/price_statistic.action.php";		//server side folder url
		var seoyURL			= "server-side/seoy/seoy.action.php";							//server side folder url
		var tName	= "report";
		var r=new Object();
		var v= new Object();									//table name

		$(document).ready(function () {
			$(document).on("click", "#client-widget", function () {
				LoadTable();
			});
		    LoadTable();
		    SeoY("client", seoyURL, "opt", "", 0);

			$(document).on("click", ".combobox", function(event) {
	            var i = $(this).text();
	           $("#" + i).autocomplete("search", "");
	        });
  		});


		function LoadTable(){
			v.product=$("#client").val();
			v.act="chart";

			GetDataTable1(tName, aJaxURL, "get_list&product="+v.product, 4, '', 0, "", 1, "desc");

            $.getJSON(aJaxURL,v,function(result){
    		$('#container_chart').highcharts({
    	        title: {text:  v.product },
    			chart: { type: 'column' },
    			 xAxis:	 result.xAxis ,
    			 series: result.series
    		});

          });




		    $("#" + tName + " tbody").off("dblclick");
		    $("#" + tName + " tbody").on("dblclick", "tr", function () {
		        var nTds = $("td", this);
		        var empty = $(nTds[1]).attr("class");

		        if (empty != "dataTables_empty") {
		            var rID = $(nTds[1]).text();

		            $.ajax({
		                url: aJaxURL,
		                type: "POST",
		                data: "act=single_chart&id=" + rID+"&product="+$("#client").val() ,
		                dataType: "json",
		                success: function (data) {
		                        	data.series[0].type='area';
		    		        		$('#container_chart').highcharts({
		    		        			 title: {text: rID },
		    		        	        chart: { zoomType: 'x' },
			   		        			 xAxis:	 data.xAxis ,
			   		        			 series: data.series
			   		        		});



		                }
		            });
		        }
		    });



		}

    </script>
</head>

<body>
    <div id="dt_example" class="ex_highlight_row">
        <div id="container" style="width: 90%">
            <div id="dynamic">
            	<h2 align="center">პასიური კლიენტები</h2>
				<br>
				<br/>
				<table style="width: 100%">
				<tr><td>
				<br/>
				<div class="seoy-row" id="client_seoy">
                   <input type="text" style="height: 16px;" id="client" class="inpt seoy-address" />
                   <button id="client_btn" class="combobox">client</button>
                </div>
				<br/><br/>				<br/>
				<br/>
				 <table class="display" id="report">
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 100%;">მომწოდებელი</th>
                            <th style="width: 80px;">ფასი</th>
                        </tr>
                    </thead>
                </table>

				 </td><td style="width: 70%">
            <div id="container_chart"></div>
				  </td> </tr>
				</table>

            </div>
            <div class="spacer">
            </div>
        </div>
    </div>
</body>
</html>